package com.pz.gulimall.order;

import org.mybatis.spring.annotation.MapperScan;
import org.springframework.amqp.rabbit.annotation.EnableRabbit;
import org.springframework.amqp.support.converter.Jackson2JsonMessageConverter;
import org.springframework.amqp.support.converter.MessageConverter;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
import org.springframework.cloud.openfeign.EnableFeignClients;
import org.springframework.context.annotation.Bean;
import org.springframework.scheduling.annotation.EnableScheduling;

@SpringBootApplication
@MapperScan("com.pz.gulimall.order.dao")
@EnableDiscoveryClient
@EnableFeignClients(basePackages = "com.pz.gulimall.order.feign")
@EnableScheduling
public class GuLiMallOrderApplication {

    public static void main(String[] args) {
        SpringApplication.run(GuLiMallOrderApplication.class, args);
    }

    /**
     * 消息转换
     */
    @Bean
    public MessageConverter messageConverter(){
        //定义消息转换器
        Jackson2JsonMessageConverter jjmc = new Jackson2JsonMessageConverter();
        //设置消息ID
        jjmc.setCreateMessageIds(true);
        return jjmc;
    }
}
